<template>
	<view class="content">
		<view class="mix-list-cell" :class="border" @click="onClick" hover-class="cell-hover" :hover-stay-time="50">
			<text v-if="icon" class="cell-icon iconfont" :style="[{color: iconColor}]" :class="icon"></text>
			<text class="cell-tit clamp">{{ title }}</text>
			<text v-if="tips" class="cell-tip">{{ tips }}</text>
			<button class="cell-more iconfont icon-more open-data-btn" open-type="contact"
				v-if="type === 'contact'"></button>
			<text class="cell-more iconfont" :class="typeList[navigateType]" v-else></text>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'list-cell',
		props: {
			icon: {
				type: String,
				default: ''
			},
			title: {
				type: String,
				default: '标题'
			},
			tips: {
				type: String,
				default: ''
			},
			navigateType: {
				type: String,
				default: 'right'
			},
			border: {
				type: String,
				default: 'b-b'
			},
			hoverClass: {
				type: String,
				default: 'cell-hover'
			},
			iconColor: {
				type: String,
				default: '#A8B5CD'
			},
			type: {
				type: String,
				default: null
			}
		},
		data() {
			return {
				typeList: {
					right: 'icon-more'
				}
			};
		},
		methods: {
			onClick() {
				if (this.type !== 'contact') {
					this.$emit('eventClick');
				}
			}
		}
	}
</script>

<style lang="scss">
	.icon .mix-list-cell.b-b:after {
		left: 90upx;
	}

	.mix-list-cell {
		display: flex;
		align-items: baseline;
		padding: 20upx $page-row-spacing;
		line-height: 60upx;
		position: relative;

		&.cell-hover {
			background: #fafafa;
		}

		&.b-b:after {
			left: 30upx;
		}

		.cell-icon {
			align-self: center;
			width: 56upx;
			max-height: 60upx;
			font-size: 38upx;
		}

		.cell-more {
			align-self: center;
			font-size: 30upx;
			color: #ccc;
			margin-left: $uni-spacing-row-sm;
		}

		.cell-tit {
			flex: 1;
			font-size: $font-base;
			color: $font-color-dark;
			margin-right: 10upx;
		}

		.cell-tip {
			font-size: $font-sm + 2upx;
			color: $font-color-light;
		}
	}
</style>